double fminbr(double a,double b, double (*f)(double x),double tol);
double f(double x);
void gnomesort(int n, double * ar);
void get_random_knots(struct SP_1D * sp, struct L2_1D_DATA * data );
double get_L2_error(struct SP_1D * sp, struct L2_1D_DATA * data );
double opt_knot(void);

struct SP_1D * par_fit(int seed, int order, int n, double * glob_sse);
struct SP_1D * get_one_less_knot(int i, struct SP_1D * sp);
struct SP_1D * step_down_fit( int order, int n_large, int n_final, double * glob_sse);
struct SP_1D * step_down_iter(int num_tries, int order, int n_large, int n_final);

double fun(double x, int i);
